<?xml version='1.0' encoding='UTF-8' ?>

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:fn="http://java.sun.com/jsp/jstl/functions"
                xmlns:h="http://java.sun.com/jsf/html"
                template="/WEB-INF/templates/default.xhtml">
 
    <ui:define name="content">
        <h:form class="pull-left">
            <ui:include src="customerForm.xhtml" /><br/>
            <h:commandButton class="btn" action="#{customerManager.createCustomer}" value="#{msg['form.add']}" />
        </h:form>
        <h:dataTable class="table table-striped table-bordered" value="#{customers}" var="item" rendered="#{not empty customers}">
            <h:column>
                <f:facet name="header">ID</f:facet>
                <h:outputText value="#{item.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header"><h:outputText value="#{msg['name']}"/></f:facet>
                <h:outputText value="#{item.name}"/>
            </h:column>
            <h:column>
                <f:facet name="header"><h:outputText value="#{msg['customer.street']}"/></f:facet>
                <h:outputText value="#{item.address}"/>
            </h:column>
            <h:column>
                <f:facet name="header"><h:outputText value="#{msg['customer.zip']}"/></f:facet>
                <h:outputText value="#{item.zip}"/>
            </h:column>
            <h:column>
                <f:facet name="header"><h:outputText value="#{msg['customer.city']}"/></f:facet>
                <h:outputText value="#{item.city}"/>
            </h:column>
            <h:column>
                <f:facet name="header"><h:outputText value="#{msg['customer.country']}"/></f:facet>
                <h:outputText value="#{item.country}"/>
            </h:column>
            <h:column>
                <f:facet name="header"><h:outputText value="#{msg['customer.accountNumber']}"/></f:facet>
                <h:outputText value="#{item.accountNumber}"/>
            </h:column>
            <h:column>
                <f:facet name="header"><h:outputText value="#{msg['actions']}"/></f:facet>
                <h:button class="btn" outcome="customerEdit" value="#{msg['form.edit']}">
                    <f:param name="id" value="#{item.id}" />
                </h:button>
            </h:column>
        </h:dataTable>
    </ui:define>
</ui:composition>

